'arc negative example from http://cairographics.org/samples'

out_file_name = __file__[:-1] + 'ng'#'example_arc_negative.png'

surface_width = 256
surface_height = 256

xc = 128.0;
yc = 128.0;
radius = 100.0;

import os
os.environ['_CAIRO_LIBRARY_'] = 'cairo_1_10_2'

from cairo_ctypes import *

angle1 = 45.0  * (M_PI/180.0);  # angles are specified */
angle2 = 180.0 * (M_PI/180.0);  # in radians           */

surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, surface_width, surface_height);
cr = cairo_create(surface)

cairo_set_line_width (cr, 10.0);
cairo_arc_negative (cr, xc, yc, radius, angle1, angle2);
cairo_stroke (cr);

# draw helping lines */
cairo_set_source_rgba (cr, 1, 0.2, 0.2, 0.6);
cairo_set_line_width (cr, 6.0);

cairo_arc (cr, xc, yc, 10.0, 0, 2*M_PI);
cairo_fill (cr);

cairo_arc (cr, xc, yc, radius, angle1, angle1);
cairo_line_to (cr, xc, yc);
cairo_arc (cr, xc, yc, radius, angle2, angle2);
cairo_line_to (cr, xc, yc);
cairo_stroke (cr);

cairo_surface_write_to_png(surface, out_file_name)

print('Result see in %s' % out_file_name)
